home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / README < prev   
Text File  |  1990-05-25  |  55KB  |  1,453 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.        Release Notes  NIH Class Library Revision 3.0  Release Notes
  8.  
  9.  
  10.  
  11.  
  12.             INTRODUCTION
  13.  
  14.             These are the release notes for Revision 3.0 of the NIH  Class
  15.             Library, the version of the library described by our book Data
  16.             Abstraction and Object-Oriented Programming in C++ by Keith E.
  17.             Gorlen,  Sanford  M.  Orlow,  and  Perry S. Plexico (ISBN 0471
  18.             92346 X), published by John Wiley and Sons.
  19.  
  20.             This release of the NIH Class Library contains  the  following
  21.             classes:
  22.  
  23.             NIHCL---Library Static Member Variables and Functions
  24.                 Object---Root of the NIH Class Library Inheritance Tree
  25.                     Bitset---Set of Small  Integers  (like  Pascal's  type
  26.             SET)
  27.                     Class---Class Descriptor
  28.                     Collection---Abstract Class for Collections
  29.                         Arraychar---Byte Array
  30.                         ArrayOb---Array of Object Pointers
  31.                         Bag---Unordered Collection of Objects
  32.                         SeqCltn---Abstract  Class  for  Ordered,   Indexed
  33.             Collections
  34.                             Heap---Min-Max Heap of Object Pointers
  35.                             LinkedList---Singly-Linked List
  36.                             OrderedCltn---Ordered  Collection  of   Object
  37.             Pointers
  38.                                 SortedCltn---Sorted Collection
  39.                                     KeySortCltn---Keyed Sorted Collection
  40.                             Stack---Stack of Object Pointers
  41.                         Set---Unordered   Collection   of    Non-Duplicate
  42.             Objects
  43.                             Dictionary---Set of Associations
  44.                                 IdentDict---Dictionary  Keyed  by   Object
  45.             Address
  46.                             IdentSet---Set Keyed by Object Address
  47.                     Date---Gregorian Calendar Date
  48.                     FDSet---Set of File Descriptors for Use with select(2)
  49.             System Call
  50.                     Float---Floating Point Number
  51.                     Fraction---Rational Arithmetic
  52.                     Integer---Integer Number Object
  53.                     Iterator---Collection Iterator
  54.                     Link---Abstract Class for LinkedList Links
  55.                         LinkOb---Link Containing Object Pointer
  56.                         Process---Co-routine Process Object
  57.                             HeapProc---Process with Stack in Free Store
  58.                             StackProc---Process with Stack on main() Stack
  59.                     LookupKey---Abstract Class for Dictionary Associations
  60.                         Assoc---Association of Object Pointers
  61.  
  62.  
  63.  
  64.             May 25, 1990                                          Page 1
  65.  
  66.  
  67.  
  68.  
  69.  
  70.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  71.  
  72.  
  73.                         AssocInt---Association  of  Object  Pointer   with
  74.             Integer
  75.                     Nil---The Nil Object
  76.                     Point---X-Y Coordinate Pair
  77.                     Random---Random Number Generator
  78.                     Range---Range of Integers
  79.                     Rectangle---Rectangle Object
  80.                     Scheduler---Co-routine Process Scheduler
  81.                     Semaphore---Process Synchronization
  82.                     SharedQueue---Shared Queue of Objects
  83.                     String---Character String
  84.                         Regex---Regular Expression
  85.                     Time---Time of Day
  86.                     Vector---Abstract Class for Vectors
  87.                         BitVec---Bit Vector
  88.                         ByteVec---Byte Vector
  89.                         ShortVec---Short Integer Vector
  90.                         IntVec---Integer Vector
  91.                         LongVec---Long Integer Vector
  92.                         FloatVec---Floating Point Vector
  93.                         DoubleVec---Double-Precision Floating Point Vector
  94.                 OIOifd---File Descriptor Object I/O readFrom() Formatting
  95.                 OIOin---Abstract   Class   for   Object   I/O   readFrom()
  96.             Formatting
  97.                     OIOistream---Abstract  Class  for  Stream  Object  I/O
  98.             readFrom() Formatting
  99.                         OIOnihin---Stream Object I/O readFrom() Formatting
  100.                 OIOofd---File Descriptor Object I/O storeOn() Formatting
  101.                 OIOout---Abstract   Class   for   Object   I/O   storeOn()
  102.             Formatting
  103.                     OIOostream---Abstract  Class  for  Stream  Object  I/O
  104.             storeOn() Formatting
  105.                         OIOnihout---Stream Object I/O storeOn() Formatting
  106.                 ReadFromTbl---Tables used by Object I/O readFrom()
  107.                 StoreOnTbl---Tables used by Object I/O storeOn()
  108.  
  109.  
  110.  
  111.             CHANGES BETWEEN OOPS V2R2 AND NIHCL R3.0
  112.  
  113.             This section highlights the most significant changes that have
  114.             been  made since the previous release.  It is by no stretch of
  115.             the imagination complete.
  116.  
  117.             Library name changed from "OOPS" to "NIH Class Library"
  118.             (NIHCL)
  119.  
  120.             Since there's too many things called "OOPS" these days,  we've
  121.             changed  the  name  of our library to the "NIH Class Library".
  122.             All file and C++ names containing "OOPS"  have  been  changed,
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.             Page 2                                          May 25, 1990
  131.  
  132.  
  133.  
  134.  
  135.  
  136.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  137.  
  138.  
  139.             often just by substituting "NIHCL" for "OOPS".
  140.  
  141.             Class NIHCL
  142.  
  143.             With the introduction of static member functions and  (useful)
  144.             static  member  variables  in  R2.0,  it  is  now  possible to
  145.             eliminate most global names.  In  R3.0,  we've  gathered  many
  146.             previously global functions and variables and made them static
  147.             members of a new class, NIHCL, which  is  the  base  class  of
  148.             Object.  Here's a list of the public functions:
  149.  
  150.                  static class NIHCL {
  151.                  // ...
  152.                  public:             // static member functions
  153.                      static unsigned char charBitMask(int i);
  154.                      static unsigned short shortBitMask(int i);
  155.                      static unsigned int intBitMask(int i);
  156.                      static unsigned char bitCount(int i);
  157.                      static unsigned char bitReverse(int i);
  158.                      static void initialize();           // library
  159.                  initialization
  160.                      static bool initialized();          // library
  161.                  initialized?
  162.                      static void setError(int error, int sev ...);
  163.                  } NIHCL_init;
  164.  
  165.             Since all NIH Library classes  inherit  these  members,  their
  166.             member  functions  can  use  these  names  without  needing to
  167.             specify a scope  qualifier,  except  to  resolve  ambiguities.
  168.             However,  non-member functions and member functions of classes
  169.             not derived from NIHCL can access them with  the  NIHCL  scope
  170.             qualifier; for example:
  171.  
  172.                  NIHCL::setError(ERROR_CODE, DEFAULT);
  173.  
  174.             Optional support for multiple inheritance
  175.  
  176.             The NIH Class Library can  be  compiled  to  support  Multiple
  177.             Inheritance  (MI) by defining the preprocessor symbol MI.  All
  178.             classes linked together  in  a  program  must  all  have  been
  179.             compiled with the same MI option setting.  The major effect of
  180.             this switch is that all classes derived from Object specify it
  181.             as  a virtual base class.  Since C++ does not permit a pointer
  182.             to a virtual base class to be cast down  to  a  pointer  to  a
  183.             derived  class,  the  new  DECLARE_MEMBERS  macro  defines  an
  184.             overloaded family of static member functions named  castDown()
  185.             that  can  perform  this  conversion.  (If  MI is not enabled,
  186.             castDown() becomes an ordinary pointer cast.)
  187.  
  188.             The castDown() functions all call the function _castDown()  to
  189.             perform  the pointer conversion.  If a class has only a single
  190.             base class, it uses the DEFINE_CLASS and DEFINE_ABSTRACT_CLASS
  191.             preprocessor   macros   as   before,  and  these  generate  an
  192.             implementation  of  _castDown()  suitable   for   the   single
  193.  
  194.  
  195.  
  196.             May 25, 1990                                          Page 3
  197.  
  198.  
  199.  
  200.  
  201.  
  202.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  203.  
  204.  
  205.             inheritance  case.   If  a class has multiple base classes, it
  206.             uses  the  new  DEFINE_CLASS_MI  and  DEFINE_ABSTRACT_CLASS_MI
  207.             macros, which do not generate _castDown()---the class provider
  208.             must supply a definition as described in Template_c.
  209.  
  210.             All  readFrom()  constructors  must  specify  the   readFrom()
  211.             constructor  for  the  virtual  base  class  Object  in  their
  212.             initialization lists when MI is enabled.  See  Template_h  for
  213.             details.
  214.  
  215.             If you use virtual base classes in conjunction  with  the  NIH
  216.             Class  Library,  you  must  take  care  when  implementing the
  217.             deepCopy()  and  storeOn()  operations  that  a  virtual  base
  218.             class's  member  variables  are  only deepened or stored once.
  219.             The  library  provides   the   functions   deepenVBase()   and
  220.             storeVBaseOn()  to help with this.  Call deepenVBase() instead
  221.             of deepenShallowCopy() to deepen the  member  variables  of  a
  222.             virtual   base  class,  and  call  storeVBaseOn()  instead  of
  223.             storer() to store the  member  variables  of  a  virtual  base
  224.             class.
  225.  
  226.             DECLARE_MEMBERS  macro
  227.  
  228.             The  new  DECLARE_MEMBERS  preprocessor  macro  generates  the
  229.             declarations  for  the class descriptor and most of the member
  230.             functions  that  all  NIH  Library   classes   must   provide,
  231.             including:
  232.  
  233.                  private:
  234.                          static Class classDesc;         // class
  235.                  descriptor
  236.                  public:
  237.                          classname* castDown(Object*);
  238.                          const classname* castDown(const Object*);
  239.                          classname& castDown(Object&);
  240.                          const classname& castDown(const Object&);
  241.                          static const Class* desc();             // return
  242.                  class descriptor
  243.                          static classname* readFrom(OIOin&);
  244.                          static classname* readFrom(OIOifd&);
  245.                          classname(OIOin&);                      //
  246.                  readFrom() constructors
  247.                          classname(OIOout&);
  248.                          virtual const Class* isA() const;
  249.                          virtual Object* shallowCopy() const;
  250.                          virtual void* _castdown(const Class&) const;
  251.                  protected:
  252.                     void deepenVBase();
  253.                          void storeVBaseOn(OIOofd&) const;       // store
  254.                  virtual base class
  255.                          void storeVBaseOn(OIOout&) const;
  256.                  private:
  257.                          static Object* reader(OIOin& strm);
  258.                          static Object* reader(OIOifd& fd);
  259.  
  260.  
  261.  
  262.             Page 4                                          May 25, 1990
  263.  
  264.  
  265.  
  266.  
  267.  
  268.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  269.  
  270.  
  271.             The DECLARE_MEMBERS macro takes a single argument, the name of
  272.             the class being declared.
  273.  
  274.             New implementation of Process classes
  275.  
  276.             In R3.0, class Process has two derived classes, StackProc  and
  277.             HeapProc,   which   serve  as  the  base  classes  for  client
  278.             processes.  StackProc and HeapProc differ in where a process's
  279.             stack  is located when the process is running: a StackProc has
  280.             its stack located on the real  stack  in  the  stack  segment,
  281.             while a HeapProc has its stack in the free storage area in the
  282.             data segment.   A  context  switch  of  a  StackProc  involves
  283.             copying  the active part of the current process's stack into a
  284.             save area, then copying the saved stack  of  the  new  process
  285.             onto  the real stack.  A context switch of a HeapProc involves
  286.             simply resetting  the  processor's  stack  pointer  and  frame
  287.             pointer  registers  to  point to the new stack, so a StackProc
  288.             context switch is much slower than a HeapProc context  switch.
  289.             However,  using  HeapProcs  tends  to  break  debuggers, which
  290.             usually  can't  cope  with  the  bizarre  stack  location,  so
  291.             programs  using  them are difficult to debug.  Also, the stack
  292.             area for a HeapProc must be specified when it is  constructed,
  293.             and  must  be  large enough to hold the largest stack that can
  294.             occur anytime during execution.  In contrast, the  stack  save
  295.             area  for a StackProc grows in size if necessary and must only
  296.             be large enough to hold the largest  stack  in  use  when  the
  297.             process is suspended.  Thus, the tradeoff is debuggability and
  298.             reduced memory requirement vs. speed.
  299.  
  300.             Fiddling  with  the  stack  area  and  machine  registers   is
  301.             something  you  can't  do  directly from C++, so processes are
  302.             inherently  non-portable.   The  R3.0  implementation  of  the
  303.             Process  classes  attempts  to  use  the  C  library  routines
  304.             setjmp(), longjmp(), and alloca()  to  do  context  switching.
  305.             While  this works on many machines, you may need to write your
  306.             own versions of  these  routines  for  machines  on  which  it
  307.             doesn't.   See  the section on PORTING THE PROCESS CLASSES for
  308.             instructions.
  309.  
  310.             External class_classname identifiers eliminated
  311.  
  312.             The class descriptor for each class no longer has an  external
  313.             identifier  of  the  form class_classname.  Instead, the class
  314.             descriptor is a static member variable of each class, and  the
  315.             inline static member function desc() returns its address.
  316.  
  317.             Changes to Object I/O
  318.  
  319.             Previous releases of OOPS have a fundamental  problem  in  the
  320.             way  they  handle object I/O for classes with member variables
  321.             that are class instances.  For example, consider an OOPS class
  322.             X  with  a member variable of class M, where M is also an OOPS
  323.             class:
  324.  
  325.  
  326.  
  327.  
  328.             May 25, 1990                                          Page 5
  329.  
  330.  
  331.  
  332.  
  333.  
  334.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  335.  
  336.  
  337.                  class X : public BASE {
  338.                      M m;    // a member class instance
  339.                      M* p;   // a member pointer to a class instance
  340.                      int i;  // a fundamental type
  341.                  // ...
  342.                  };
  343.  
  344.             Previous releases implement X::storer() and  X::X(istream&,X&)
  345.             as follows:
  346.  
  347.                  void X::storer(ostream& strm)
  348.                  {
  349.                      BASE::storer(strm);
  350.                      m.storeOn(strm);
  351.                      p->storeOn(strm);
  352.                      strm << i << " ";
  353.                  }
  354.  
  355.                  void X::X(istream&strm, X& where)
  356.                      : (strm,where)
  357.                  {
  358.                      this = &where;
  359.                      readFrom(strm,"M",m);
  360.                      p = (M*)readFrom(strm,"M");
  361.                      strm >> i;
  362.                  }
  363.  
  364.                  void X::storer(FileDescTy& fd)
  365.                  {
  366.                      BASE::storer(fd);
  367.                      m.storeOn(fd);
  368.                      p->storeOn(fd);
  369.                      storeBin(fd,i);
  370.                  }
  371.  
  372.                  void X::X(FileDescTy& fd, X& where)
  373.                      : (fd,where)
  374.                  {
  375.                      this = &where;
  376.                      readFrom(fd,"M",m);
  377.                      p = (M*)readFrom(fd,"M");
  378.                      readBin(fd,i);
  379.                  }
  380.  
  381.             The problem is that this constructor first initializes m using
  382.             the   M::M()   constructor,   then   calls  readFrom(),  which
  383.             overwrites  this  initialized  instance   with   an   instance
  384.             constructed  by  reading  strm.   We  didn't  notice  this bug
  385.             earlier because, in  practice,  the  problem  occurs  only  in
  386.             classes   Rectangle   and  SharedQueue,  and  has  no  obvious
  387.             consequences. The worst that  is  likely  to  happen  is  that
  388.             M::M() allocates some memory that never gets reclaimed.
  389.  
  390.             Unfortunately, the fix requires some widespread changes.  But,
  391.  
  392.  
  393.  
  394.             Page 6                                          May 25, 1990
  395.  
  396.  
  397.  
  398.  
  399.  
  400.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  401.  
  402.  
  403.             it turns out that numerous other improvements become possible.
  404.             The  new  format  for  storer()   functions   and   readFrom()
  405.             constructors when not using MI is:
  406.  
  407.                  void X::storer(OIOout& strm)
  408.                  {
  409.                      BASE::storer(strm);
  410.                      m.storeMemberOn(strm);
  411.                      p->storeOn(strm);
  412.                      strm << i;
  413.                  }
  414.  
  415.                  void X::X(OIOin& strm)
  416.                      : (strm), m(strm)
  417.                  {
  418.                      p = M::readFrom(strm);
  419.                      strm >> i;
  420.                  }
  421.  
  422.                  void X::storer(OIOofd& fd)
  423.                  {
  424.                      BASE::storer(fd);
  425.                      m.storeMemberOn(fd);
  426.                      p->storeOn(fd);
  427.                      fd << i;
  428.                  }
  429.  
  430.                  void X::X(OIOifd& fd)
  431.                      : (fd), m(fd)
  432.                  {
  433.                      p = M::readFrom(fd);
  434.                      fd >> i;
  435.                  }
  436.  
  437.             The new format is simpler and consistent---storer()  functions
  438.             always   call  BASE::storer()  and  X::X(OIOin&)  constructors
  439.             always call BASE::BASE(OIOin&).
  440.  
  441.             Public readFrom() constructor
  442.  
  443.             Since  other  classes  in  general   must   have   access   to
  444.             X::X(OIOin&),   it   must  be  public  instead  of  protected,
  445.             requiring a change to all header files.
  446.  
  447.             Changes to readFrom()
  448.  
  449.             As explained previously, calls to readFrom() that specify  the
  450.             third  argument  overwrite an initialized instance of a class.
  451.             Since this is generally a bad thing to do, the third  argument
  452.             to  readFrom() has been eliminated; thus, readFrom() will only
  453.             return a pointer to an object. This  form  of  readFrom()  was
  454.             used  to initialize member class instances.  These must now be
  455.             initialized via the readFrom() constructor in the  initializer
  456.             list,  as shown in the example.  When converting old programs,
  457.  
  458.  
  459.  
  460.             May 25, 1990                                          Page 7
  461.  
  462.  
  463.  
  464.  
  465.  
  466.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  467.  
  468.  
  469.             these calls to readFrom() will be flagged  as  errors  because
  470.             the  three  argument  form of readFrom() is no longer defined.
  471.             Note that when you change the readFrom() constructor, you must
  472.             also  change  the corresponding storer() function to store the
  473.             member using storeMemberOn() rather than storeOn().
  474.  
  475.             In previous releases, the second argument to readFrom() was an
  476.             optional  name  of the class of object that was expected to be
  477.             read.  If the object read was of a different class, readFrom()
  478.             raised    an    error.     Beginning    with   this   release,
  479.             readFrom(OIOin&),  and  readFrom(OIOifd&)  are  static  member
  480.             functions of each class which will also accept derived classes
  481.             of the specified class, just as C++  allows  a  pointer  to  a
  482.             derived class to be used instead of a pointer to a base class.
  483.             The global functions readFrom(istream, const char*  classname)
  484.             and   readFrom(int   fd,  const  char*  classname)  have  been
  485.             eliminated.
  486.  
  487.             istream& replaced by OIOin&
  488.  
  489.             The  type  of  the  first  (and  now  only)  argument  to  the
  490.             constructors  called  by  readFrom(istream&)  has been changed
  491.             from an istream& to an OIOin&.  This avoids  naming  conflicts
  492.             with  other  constructors.   Also,  OIOin  is an abstract base
  493.             class, and all input operators are virtual functions,  so  you
  494.             can  customize  the  Object  I/O  format  by defining your own
  495.             derived classes.   OIOistream and OIOnihin implement a  format
  496.             similar to the old OOPS format.
  497.  
  498.             ostream& replaced by OIOout&
  499.  
  500.             The type of the argument to the storer(ostream&) function  has
  501.             been  changed   to  an  OIOout&.   OIOout  is an abstract base
  502.             class, and all output operators are virtual functions, so  you
  503.             can  customize  the  Object  I/O  format  by defining your own
  504.             derived classes. OIOostream and OIOnihout implement  a  format
  505.             similar to the old OOPS format.
  506.  
  507.             Automatic separators output by OIOostream::operator<<()
  508.  
  509.             It is no longer necessary to explicitly output a  space  after
  510.             each  number  written in a storer(OIOnihout&) function.  Class
  511.             OIOostream  reimplements  operator<<()  to  supply  the  space
  512.             automatically.
  513.  
  514.             FileDescTy& replaced by OIOifd&/OIOofd&
  515.  
  516.             The type of the argument to the  storer(FileDescTy&)  function
  517.             has  been  changed   to  an  OIOofd&.  and the argument to the
  518.             readFrom(FileDescTy&) function has been changed to an OIOifd&.
  519.             OIOifd  and  OIOofd  are  not  abstract classes, and their I/O
  520.             operators are not virtual functions as in OIOin and OIOout, so
  521.             using  them  does not incur the overhead of a virtual function
  522.  
  523.  
  524.  
  525.  
  526.             Page 8                                          May 25, 1990
  527.  
  528.  
  529.  
  530.  
  531.  
  532.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  533.  
  534.  
  535.             call for each member variable.
  536.  
  537.             Change to readFrom(OIOin&)
  538.  
  539.             Encountering EOF during  readFrom(OIOin&)  is  now  always  an
  540.             error.  Previous releases returned nil if the input stream was
  541.             initially at  the  EOF.   readFrom(OIOin&)  now  behaves  like
  542.             readFrom(OIOifd&) always has.
  543.  
  544.             storeBin() replaced by OIOofd::operator<<() and OIOofd::put()
  545.  
  546.             The function storeBin(FileDescTy&, type) has been replaced  by
  547.             OIOofd::operator<<(type)        and        the        function
  548.             storeBin(FileDescTy&, type*, unsigned) has  been  replaced  by
  549.             OIOofd::put(type*, unsigned).
  550.  
  551.             readBin() replaced by OIOifd::operator>>() and OIOifd::get()
  552.  
  553.             The function readBin(FileDescTy&, type) has been  replaced  by
  554.             OIOifd::operator>>(type) and the function readBin(FileDescTy&,
  555.             type*,  unsigned)  has  been  replaced  by  OIOifd::get(type*,
  556.             unsigned).
  557.  
  558.             read_Cstring() replaced by OIOin::getCstring()
  559.  
  560.             The   function   read_Cstring()   has   been    replaced    by
  561.             OIOin::getCstring().
  562.  
  563.             store_Cstring() replaced by OIOout::putCstring()
  564.  
  565.             The   function   store_Cstring()   has   been   replaced    by
  566.             OIOout::putCstring().
  567.  
  568.             READ_OBJECT_AS_BINARY eliminated
  569.  
  570.             The READ_OBJECT_AS_BINARY macro has been eliminated.   Replace
  571.             it  with  code  to read member variables individually using >>
  572.             and get().
  573.  
  574.             STORE_OBJECT_AS_BINARY eliminated
  575.  
  576.             The STORE_OBJECT_AS_BINARY macro has been eliminated.  Replace
  577.             it  with  code to store member variables individually using <<
  578.             and put().
  579.  
  580.             Changes to the DEFINE_CLASS macro
  581.  
  582.             The new version  of  the  DEFINE_CLASS  macro  has  hooks  for
  583.             supporting    multiple   inheritance.   Before   calling   the
  584.             DEFINE_CLASS  macro,  you  must  define   three   preprocessor
  585.             symbols:        BASE_CLASSES,        MEMBER_CLASSES,       and
  586.             VIRTUAL_BASE_CLASSES.  As an example, suppose you are  writing
  587.             the implementation of a class with the following declaration:
  588.  
  589.  
  590.  
  591.  
  592.             May 25, 1990                                          Page 9
  593.  
  594.  
  595.  
  596.  
  597.  
  598.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  599.  
  600.  
  601.                  class X: public A, public virtual B {
  602.                      C c;        // C is a class
  603.                      D d;        // D is a class
  604.                  //...
  605.                  };
  606.  
  607.             Set the symbol BASE_CLASSES to a list of the addresses of  the
  608.             class  descriptors  for  the base classes of the class you are
  609.             defining.  These must be in the same order as they  appear  in
  610.             the class declaration:
  611.  
  612.                  #define BASE_CLASSES A::desc(), B::desc()
  613.  
  614.             Set the symbol MEMBER_CLASSES to a list of  the  addresses  of
  615.             the  class  descriptors  for any member variables of the class
  616.             that are NIH Library classes.  These must be in the same order
  617.             as they appear in the class declaration:
  618.  
  619.                  #define MEMBER_CLASSES C::desc(), D::desc()
  620.  
  621.             If a class has no class members,  define  MEMBER_CLASSES,  but
  622.             give it no value.
  623.  
  624.             Set the symbol VIRTUAL_BASE_CLASSES to a list of the addresses
  625.             of  the  class descriptors for the virtual base classes of the
  626.             class you are defining.  These must be in the  same  order  as
  627.             they appear in the class declaration:
  628.  
  629.                  #define VIRTUAL_BASE_CLASSES B::desc()
  630.  
  631.             If   a   class   has   no   virtual   base   classes,   define
  632.             VIRTUAL_BASE_CLASSES, but give it no value.
  633.  
  634.             Now you are ready to call the DEFINE_CLASS macro:
  635.  
  636.                  DEFINE_CLASS(classname,version,identification,initor1,initor2)
  637.  
  638.             Classname is the name of the class you are defining.
  639.  
  640.             Version is the version number of the class you  are  defining.
  641.             It  should  be  changed whenever the format of the information
  642.             written by the  storer()  function  changes  such  that  older
  643.             versions of readFrom() can no longer interpret it correctly.
  644.  
  645.             Identification is  a  character  string  that  identifies  the
  646.             revision  level  of  the  implementation  of the class.  It is
  647.             simply stored in the class descriptor where you  can  retrieve
  648.             it by calling the function Class::ident().  The identification
  649.             parameter is intended for use with a revision  control  system
  650.             such  as  RCS  or SCCS.  NIH Library classes specify it as the
  651.             string  "$Header$",  which  RCS  replaces  with  the  revision
  652.             identification.
  653.  
  654.             Initor1 and initor2 are pointers to functions you  may  supply
  655.  
  656.  
  657.  
  658.             Page 10                                         May 25, 1990
  659.  
  660.  
  661.  
  662.  
  663.  
  664.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  665.  
  666.  
  667.             to   perform   initialization  for  the  class,  for  example,
  668.             initializing static data that the class uses.
  669.  
  670.             DEFINE_ABSTRACT_CLASS
  671.  
  672.             Abstract    classes    should    use     the     new     macro
  673.             DEFINE_ABSTRACT_CLASS       instead      of      DEFINE_CLASS.
  674.             DEFINE_ABSTRACT_CLASS has the same arguments as  DEFINE_CLASS;
  675.             the   only  difference  is  that  the  reader()  functions  it
  676.             generates  do   not   reference   the   class's   object   I/O
  677.             constructors,    and    shallowCopy()    is   defined   as   a
  678.             derivedClassResponsibility().
  679.  
  680.             Change to Class::className()
  681.  
  682.             The function className() returns the name of the class of  the
  683.             object   to   which  it  is  applied.   In  previous  releases
  684.             Class::className() does not do this.  Instead, it returns  the
  685.             name of the class described by the class object to which it is
  686.             applied.   This   release   eliminates   this   inconsistency:
  687.             className()  returns  "Class"  when  applied to an instance of
  688.             class Class.  The new function Class::name() returns the  name
  689.             of the class described by an instance of class Class.
  690.  
  691.             New member functions of class Class
  692.  
  693.             Class**  baseClasses()  returns  a  zero-terminated  array  of
  694.             pointers  to the class descriptors of the base classes of this
  695.             class.
  696.  
  697.             Class** memberClasses() returns  a  zero-terminated  array  of
  698.             pointers  to  the  class  descriptors of the member classes of
  699.             this class.
  700.  
  701.             Class** virtualBaseClasses() returns a  zero-terminated  array
  702.             of  pointers  to  the  class  descriptors  of the virtual base
  703.             classes of this class.
  704.  
  705.             unsigned long signature() returns the signature of this class.
  706.             The signature of a class is computed by hashing the signatures
  707.             of this class's base and member classes and the version number
  708.             of  this  class.  It is currently used by storeOn()/readFrom()
  709.             to prevent obsolete versions of objects from being read.
  710.  
  711.             const Class* Class::lookup(const char* name) returns a pointer
  712.             to  the  class  descriptor  object  for  the  class  with  the
  713.             specified name.  Class::lookup() returns 0 if the name is  not
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.             May 25, 1990                                         Page 11
  725.  
  726.  
  727.  
  728.  
  729.  
  730.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  731.  
  732.  
  733.             found.
  734.  
  735.             Changes to copy(), shallowCopy(), and deepCopy()
  736.  
  737.             In previous releases, shallowCopy() made a bitwise copy of  an
  738.             object, and deepCopy() first made a shallow copy of an object,
  739.             and then called the virtual  function  deepenShallowCopy()  to
  740.             convert   the  shallow  copy  to  a  deep  copy.   Each  class
  741.             reimplemented deepenShallowCopy() to handle any pointer member
  742.             variables contained in instances of its class.
  743.  
  744.             The problems with this approach are that  (1)  it  is  usually
  745.             unsafe  to  make  a  shallow  copy  of an object that contains
  746.             pointers, and (2) with Release 2.0 of the AT&T C++ Translator,
  747.             objects   may   contain   compiler-generated   pointers  which
  748.             deepenShallowCopy() cannot handle easily and portably.
  749.  
  750.             The following changes have been made in an  attempt  to  solve
  751.             these problems:
  752.  
  753.             Each class now reimplements the virtual function shallowCopy()
  754.             to  call the initialization constructor X::X(const X&) to make
  755.             a  shallow  copy  of  an  object.    The   implementation   of
  756.             shallowCopy()  is  the  same  for all classes and is generated
  757.             automatically by the DEFINE_CLASS macro:
  758.  
  759.                  Object* classname::shallowCopy()
  760.                  {
  761.                      return new classname(*this);
  762.                  }
  763.  
  764.             Object::deepCopy()   still   calls   the   virtual    function
  765.             deepenShallowCopy() to convert a shallow copy, now made by the
  766.             initialization constructor, to a deep copy.  Since the shallow
  767.             copy  is  no  longer  a  simple  bitwise copy, you may need to
  768.             change deepenShallowCopy() for some classes.
  769.  
  770.             In previous releases, copy() defaulted to deepCopy() since  it
  771.             was  unsafe  for  general  use.   Beginning with this release,
  772.             copy() defaults to shallowCopy() as it does  in  Smalltalk-80.
  773.             Also, Object::deepCopy() is no longer a virtual function.
  774.  
  775.             New function dumpOn() and changes to printOn()
  776.  
  777.             To make the printOn()  function  more  useful  in  application
  778.             programs,  it  has  been  changed  to print minimal formatting
  779.             information, the idea being that this can frequently be  added
  780.             by  an  application  to  suit its specific needs.  The virtual
  781.             function dumpOn() has been added to  assist  in  debugging  by
  782.             printing    more    detailed   information   than   printOn().
  783.             Object::dumpOn() prints the name of an object's class, a  left
  784.             square  bracket ("["), calls printOn(), then prints a matching
  785.             right    square    bracket    and    a    newline     ("]\n").
  786.             Collection::dumpOn()  does  the  same,  except that it applies
  787.  
  788.  
  789.  
  790.             Page 12                                         May 25, 1990
  791.  
  792.  
  793.  
  794.  
  795.  
  796.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  797.  
  798.  
  799.             dumpOn() to all objects in the collection instead  of  calling
  800.             printOn().   Other  classes reimplement dumpOn() to print more
  801.             appropriate information.
  802.  
  803.             By default, dumpOn() sends its  output  to  cerr.   A  default
  804.             argument has also been added to printOn() so that it writes to
  805.             cout by default.
  806.  
  807.             Changes to class Link
  808.  
  809.             Constructor Link(const Link&) changed to Link(Link*)
  810.  
  811.             The constructor Link(const Link&),  which  constructs  a  Link
  812.             that  points  to  the  argument Link, has been replaced by the
  813.             constructor Link(Link*).  This change was  necessary  so  that
  814.             shallowCopy()  could call the constructor Link(const Link&) to
  815.             make a bitwise copy.  We suggest  temporarily  commenting  out
  816.             the  declaration  of  this  constructor in the file Link.h and
  817.             recompiling the programs that depend upon it so you can easily
  818.             detect  and change the code using Link(const Link&) to use the
  819.             new Link(Link*) constructor instead.
  820.  
  821.             As a result of this change, Link::shallowCopy() is now enabled
  822.             and will return a bitwise copy of a Link.
  823.  
  824.             New function isListEnd()
  825.  
  826.             Class Link has a new member function bool  isListEnd(),  which
  827.             you  must  use to check for the end of a LinkedList instead of
  828.             checking for a pointer to Nil.  Compile your program with -DMI
  829.             to find the places where you need to make this change.
  830.  
  831.             Changes to class Iterator
  832.  
  833.             Iterator::shallowCopy() now produces a  shallow  copy  with  a
  834.             pointer  to  the same collection bound to the original instead
  835.             of to a shallow copy of the collection bound to the  original,
  836.             as  in  prior releases.  Iterator::deepCopy() works as before:
  837.             it produces a deep copy with a pointer to a deep copy  of  the
  838.             collection bound to the original.
  839.  
  840.             The member  variable  Object*  state  has  been  added,  which
  841.             collection  classes  can  use  to  associate  additional state
  842.             information with an Iterator.  For example, a collection class
  843.             implemented  as  a  tree structure can use state to point to a
  844.             Stack used to maintain the state of a traversal of  the  tree.
  845.             The   destructor  for  class  Iterator  calls  a  new  virtual
  846.             function, doFinish(),  which  a  class  that  uses  state  can
  847.             reimplement  to  delete  the state object when the Iterator is
  848.             destroyed.
  849.  
  850.             The  storeOn()  format  has  changed  as  a  result  of  these
  851.             modifications.
  852.  
  853.  
  854.  
  855.  
  856.             May 25, 1990                                         Page 13
  857.  
  858.  
  859.  
  860.  
  861.  
  862.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  863.  
  864.  
  865.             The function Object* Iterator::operator()() has been added  to
  866.             return a pointer to the current object, or 0 if there is none.
  867.  
  868.             Changes to class Dictionary
  869.  
  870.             The return type of assocAt(), removeAssoc(),  and  removeKey()
  871.             has been changed from LookupKey& to LookupKey* for consistency
  872.             with    the    return    types    of    similar     functions.
  873.             Dictionary::assocAt()  returns  0 instead of nil if the key is
  874.             not found.
  875.  
  876.             const arguments to member functions
  877.  
  878.             In previous versions , it was possible to convert, or "widen",
  879.             a  pointer  to  a  const  object into a pointer to a non-const
  880.             object by adding the const object to a  collection  class  and
  881.             then removing it:
  882.  
  883.                  Object* f(const Object& co)
  884.                  {
  885.                      OrderedCltn c;
  886.                      c.add(co);
  887.                      return c.remove(co);
  888.                  }
  889.  
  890.             C++ R2.0 now issues error or warning  messages  when  a  const
  891.             pointer  is  converted into a non-const pointer.  To eliminate
  892.             these problems, the const arguments to some functions such  as
  893.             add() have been changed to non-const arguments.  These changes
  894.             affect classes Assoc, LinkOb, and the collection classes.
  895.  
  896.             If you need to add a const object to a collection  class,  you
  897.             must use an explicit cast:
  898.  
  899.                  c.add((Object&)co);
  900.  
  901.             Change to Bag::remove(const Object&)
  902.  
  903.             Bag::remove(const Object&) now returns 0 until last occurrence
  904.             removed  instead  of  the address of the argument to eliminate
  905.             "widening" of the const argument.
  906.  
  907.             shouldNotImplement() functions now private
  908.  
  909.             Virtual member functions that a  class  reimplements  to  call
  910.             shouldNotImplement()  have  been  made  private  so  that  the
  911.             compiler can  give  an  error  message  if  a  client  program
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.             Page 14                                         May 25, 1990
  923.  
  924.  
  925.  
  926.  
  927.  
  928.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  929.  
  930.  
  931.             attempts to apply the function to an instance of the class.
  932.  
  933.             Change to class Stack
  934.  
  935.             When a Stack is converted to another type of  collection,  the
  936.             objects  in the Stack are added to the collection from the top
  937.             of the stack down.  Previous releases added them bottom-up.
  938.  
  939.             Changes to class Heap
  940.  
  941.             The new member function Heap::removeId(const  Object&)  allows
  942.             you  to  remove the object that is the same (i.e. isSame()) as
  943.             the argument object from a Heap.
  944.  
  945.             Iterating over a Heap now visits the objects in  the  heap  in
  946.             sorted    order,   from   smallest   to   largest.    Previous
  947.             implementations visited  the  objects  in  heap  order.   This
  948.             affects  the  order  in which printOn() lists the objects in a
  949.             Heap, for example.
  950.  
  951.             Changes to class LinkedList
  952.  
  953.             The new member  function  LinkedList::removeId(const  Object&)
  954.             allows  you  to  remove  the  object  that  is  the same (i.e.
  955.             isSame()) as the argument object from a LinkedList.
  956.  
  957.             Changes to class LookupKey
  958.  
  959.             The virtual function Object* LookupKey::value() const has been
  960.             replaced by two virtual functions
  961.  
  962.                  virtual Object* value();
  963.                  virtual const Object* value() const;
  964.  
  965.             to  prevent  obtaining  a  non-const  pointer  from  a   const
  966.             LookupKey.
  967.  
  968.             Changes to class Arraychar
  969.  
  970.             The constructor  for  class  Arraychar  now  initializes  each
  971.             element of the the array to 0.
  972.  
  973.             The virtual function removeAll() has been  implemented,  which
  974.             resets each element of the array to 0.
  975.  
  976.             Changes to class Assoc
  977.  
  978.             The virtual function Object*  Assoc::value()  const  has  been
  979.             replaced by two virtual functions
  980.  
  981.                  virtual Object* value();
  982.                  virtual const Object* value() const;
  983.  
  984.  
  985.  
  986.  
  987.  
  988.             May 25, 1990                                         Page 15
  989.  
  990.  
  991.  
  992.  
  993.  
  994.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  995.  
  996.  
  997.             to prevent obtaining a non-const pointer from a const Assoc.
  998.  
  999.             Changes to class AssocInt
  1000.  
  1001.             The virtual function Object* AssocInt::value() const has  been
  1002.             replaced by two virtual functions
  1003.  
  1004.                  virtual Object* value();
  1005.                  virtual const Object* value() const;
  1006.  
  1007.             to  prevent  obtaining  a  non-const  pointer  from  a   const
  1008.             AssocInt.
  1009.  
  1010.  
  1011.  
  1012.             CHANGES BETWEEN OOPS V2R1 AND OOPS V2R2
  1013.  
  1014.             Class name changes
  1015.  
  1016.             The name of class Arrayobid is now ArrayOb, the name of  class
  1017.             Linkobid is now LinkOb, and the typedef obid has been removed.
  1018.             Just change all occurrences of Arrayobid to ArrayOb,  Linkobid
  1019.             to LinkOb, and obid to Object*.
  1020.  
  1021.             Type bool now int
  1022.  
  1023.             Type bool has been changed from char to int for  compatibility
  1024.             with X V11.
  1025.  
  1026.             New String class
  1027.  
  1028.             There is a new, more efficient implementation of class String.
  1029.             The  new  String class is compatible with the old String class
  1030.             except for the following:
  1031.  
  1032.                  String(char c, unsigned l =1);
  1033.  
  1034.             is now:
  1035.  
  1036.                  String(char& c, unsigned l=1,
  1037.                      unsigned extra=DEFAULT_STRING_EXTRA);
  1038.  
  1039.             The argument unsigned extra has been  added  to  most  of  the
  1040.             String::String()  constructors to allow the programmer to give
  1041.             a hint as to how much space to  allocate  in  the  string  for
  1042.             additional  characters.   When  properly used, this can reduce
  1043.             the number of calls made to the memory allocator.
  1044.  
  1045.             Assignment to substrings has changed slightly.  The old String
  1046.             class handled an assignment to a substring such as:
  1047.  
  1048.                  String s = "abcdef";
  1049.                  s(0,2) = "123";         // result is 12cdef
  1050.  
  1051.  
  1052.  
  1053.  
  1054.             Page 16                                         May 25, 1990
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  1061.  
  1062.  
  1063.             by  truncating  the  source  string  to  the  length  of   the
  1064.             destination substring.  An assignment such as:
  1065.  
  1066.                  s(0,2) = "1";           // result is 1\0cdef
  1067.  
  1068.             would cause a null byte to  be  inserted  in  the  destination
  1069.             substring.
  1070.  
  1071.             The new String class replaces the target  substring  with  the
  1072.             source  string,  adjusting  the length of the target string if
  1073.             necessary.  Thus
  1074.  
  1075.                  String s = "abcdef";
  1076.                  s(0,2) = "123";         // result is 123cdef
  1077.  
  1078.             and:
  1079.  
  1080.                  s(0,2) = "1";           // result is 1cdef
  1081.  
  1082.             Changes to Class Process
  1083.  
  1084.             An interface to select(2) has been added:
  1085.  
  1086.                  void Process::select(FDSet& rdmask, FDSet& wrmask, FDSet&
  1087.                  exmask);
  1088.  
  1089.  
  1090.  
  1091.             PORTING THE PROCESS CLASSES
  1092.  
  1093.             This section describes the steps to follow if you want to be a
  1094.             pioneer    and   port   the   Process   classes   to   a   new
  1095.             machine/operating system.
  1096.  
  1097.             If  your  target  system  provides  the  C  library   routines
  1098.             setjmp(),  longjmp(),  and alloca(), and if the implementation
  1099.             of setjmp()/longjmp() operates by saving/restoring all of  the
  1100.             machine's  volatile registers (as they do on the Sun-3, Sun-4,
  1101.             and IBM RT/AOS), then the port should be very easy; otherwise,
  1102.             you'll  need  to  write versions of these routines in assembly
  1103.             language that behave as expected.
  1104.  
  1105.             To find out how your setjmp()/longjmp() works, either look  at
  1106.             the source code for these routines (if you're fortunate enough
  1107.             to have it) or use the debugger to disassemble them.   A  data
  1108.             structure  of  type jmp_buf, defined in setjmp.h, is passed as
  1109.             an argument to these routines.  If your  setjmp()  just  saves
  1110.             all  the  volatile  registers  in  it  to be restored later by
  1111.             longjmp(), then you're probably  in  luck---all  you  need  to
  1112.             figure  out are the offsets in the jmp_buf structure where the
  1113.             PC (Program  Counter),  SP  (Stack  Pointer),  and  FP  (Frame
  1114.             Pointer) registers are saved.
  1115.  
  1116.             Next, look at nihclconfig.h and  locate  the  place  where  it
  1117.  
  1118.  
  1119.  
  1120.             May 25, 1990                                         Page 17
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  1127.  
  1128.  
  1129.             defines   the   machine-specific  inline  functions  SETJMP(),
  1130.             LONGJMP(),  _SETJMP(),  _LONGJMP(),  ENV_PC(),  ENV_SP(),  and
  1131.             ENV_FP().   These define the interface to the Process classes.
  1132.             For example, here are the definitions for  SunOS  4.0  on  the
  1133.             Sun-3:
  1134.  
  1135.                  #ifdef SUNOS4
  1136.  
  1137.                  #ifdef mc68000
  1138.                  typedef jmp_buf JMP_BUF;
  1139.                  inline int SETJMP(JMP_BUF env)              { return
  1140.                  setjmp(env); }
  1141.                  inline void LONGJMP(JMP_BUF env, int val)   {
  1142.                  longjmp(env,val); }
  1143.                  inline int _SETJMP(JMP_BUF env)             { return
  1144.                  _setjmp(env); }
  1145.                  inline void _LONGJMP(JMP_BUF env, int val)  {
  1146.                  _longjmp(env,val); }
  1147.                  inline unsigned& ENV_PC(JMP_BUF env)
  1148.                                      { return (unsigned&)env[3]; }
  1149.                  inline unsigned& ENV_SP(JMP_BUF env)
  1150.                                      { return (unsigned&)env[2]; }
  1151.                  inline unsigned& ENV_FP(JMP_BUF env)
  1152.                                      { return (unsigned&)env[15]; }
  1153.                  #endif
  1154.  
  1155.                  // ...
  1156.                  #endif
  1157.  
  1158.             Add an #if ... #endif section for your machine and define  the
  1159.             ENV_PC(),   ENV_SP(),  and  ENV_FP()  functions  to  return  a
  1160.             reference to the appropriate word in the JMP_BUF array.
  1161.  
  1162.             If your machine doesn't use both an SP  and  FP,  then  you'll
  1163.             also need to add some machine dependent C++ code to HeapProc.c
  1164.             to relocate only the one actually used.  See the code for  the
  1165.             ibm032 in HeapProc.c as an example.
  1166.  
  1167.             If   your   system    has    both    setjmp()/longjmp()    and
  1168.             _setjmp()/_longjmp(),  define  SETJMP(), LONGJMP(), _SETJMP(),
  1169.             and _LONGJMP() to call the  corresponding  routine.   If  your
  1170.             system doesn't have the "_" versions, check your documentation
  1171.             to see if  your  setjmp()/longjmp()  saves  and  restores  the
  1172.             signal  mask;  if  so, define _SETJMP() and _LONGJMP() to call
  1173.             setjmp() and longjmp(), respectively.  See the code for SUNOS3
  1174.             as an example.
  1175.  
  1176.             If your setjmp() and longjmp() do not  save  and  restore  the
  1177.             signal  mask, you'll need to provide versions that do.  Define
  1178.             JMP_BUF to be  a  struct  that  consists  of  a  jmp_buf  plus
  1179.             whatever other members you need to save the signal mask.  Then
  1180.             define _SETJMP() and _LONGJMP() to call setjmp() and longjmp()
  1181.             using  the  jmp_buf part of a JMP_BUF, and define SETJMP() and
  1182.             LONGJMP() to do the same, but in addition to save/restore  the
  1183.  
  1184.  
  1185.  
  1186.             Page 18                                         May 25, 1990
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  1193.  
  1194.  
  1195.             signal  mask  using  the  other members of a JMP_BUF.  See the
  1196.             code for the mc300 as an example.
  1197.  
  1198.             If your setjmp()/longjmp() do not work by saving/restoring all
  1199.             volatile  registers  (as  on  the  VAX),  you'll need to write
  1200.             versions with different names that do, and call these  instead
  1201.             from the interface functions.
  1202.  
  1203.             If you succeed  in  porting  the  Process  classes  to  a  new
  1204.             machine/operating  system,  we'd appreciate a copy of the code
  1205.             for inclusion in future releases.
  1206.  
  1207.  
  1208.  
  1209.             AT&T C++ TRANSLATOR RELEASE 2.00/2.1 BUGS
  1210.  
  1211.             Releases 2.00 and R2.1 of the AT&T C++ Translator have  a  few
  1212.             bugs  that  we had to insert work-arounds for in the NIH Class
  1213.             Library.   These  are  conditionally  compiled  based  on  the
  1214.             definition  of  preprocessor  symbols beginning with BUG_.  If
  1215.             you are using the NIH Class Library to test a Release 2.00  or
  1216.             2.1  -compatible  C++  compiler,  we suggest that you edit the
  1217.             master Makefile to define these symbols:
  1218.  
  1219.                  # Disable AT&T R2.0/R2.1 bug work-around code
  1220.                  #BUGDEFS =
  1221.                  BUGDEFS = -DBUG_bC2728 -DBUG_38 -DBUG_39
  1222.                  -DBUG_OPTYPECONST
  1223.  
  1224.  
  1225.  
  1226.             YACC STACK OVERFLOWS
  1227.  
  1228.             The preprocessor symbol  BUG_TOOBIG  controls  compilation  of
  1229.             code we had to insert to avoid "yacc stack overflow" errors in
  1230.             the  SunOS  3.5  C  compiler.   Release  2.0   produces   very
  1231.             complicated  expressions  for  the inline copy constructors it
  1232.             generates for  deeply-derived  classes.   Explicitly  defining
  1233.             non-inline copy constructors solves the problem.  If you are a
  1234.             C compiler vendor, please  make  your  tables  big  enough  to
  1235.             handle the C code generated by the AT&T C++ Translator!
  1236.  
  1237.  
  1238.  
  1239.             COMPILING UNDER AT&T C++ TRANSLATOR RELEASE 2.1
  1240.  
  1241.             R3.0 of the NIH Class Library has been tested with Release 2.1
  1242.             of  the  AT&T  C++  Translator under SunOS 4.0.  The following
  1243.             subsections summarize the changes required when compiling with
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.             May 25, 1990                                         Page 19
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  1259.  
  1260.  
  1261.             R2.1.
  1262.  
  1263.             Inconsistent declarations of alloca() in header files
  1264.  
  1265.             The header files supplied with R2.1 declare  alloca()  with  a
  1266.             return type of void* in alloca.h and char* in malloc.h, so you
  1267.             get an error message from the  compiler  when  both  of  these
  1268.             files  are  included  in the same compilation unit.  We solved
  1269.             this problem by changing the return type of the declaration of
  1270.             alloca() in malloc.h to void*.
  1271.  
  1272.             Warning and error messages due to #pragmas in SunOS 4.0 header
  1273.             files
  1274.  
  1275.             The C compiler occasionally issues warning  messages  such  as
  1276.             the  following  when  compiling  the  output  of  the AT&T C++
  1277.             Translator (both R2.0 and R2.1) under SunOS 4.0:
  1278.  
  1279.                  "/usr/include/CC/sys/signal.h",  line  38:  warning:
  1280.                  function name expected
  1281.  
  1282.             This is because C++ doesn't understand the #pragma  directives
  1283.             it  encounters in some system header files,  so it just passes
  1284.             them through to the C compiler.  The warning  message  results
  1285.             because  C++  eliminates  or moves the C function declarations
  1286.             that the pragma references.  Another problem is that  the  C++
  1287.             header   files   use  #define  to  temporarily  rename  system
  1288.             functions when they include the vendor's C header files  as  a
  1289.             way  to  hide  the  effects of the vendor's C declarations for
  1290.             these functions.  Unfortunately,  this  garbles  the  function
  1291.             names in the #pragma directives also.
  1292.  
  1293.             Under R2.0,  the  #pragma  problem  just  results  in  warning
  1294.             messages, but under R2.1, the C compilation occasionally fails
  1295.             with an error message.  We manually made a new, self-contained
  1296.             version  of /usr/include/CC/setjmp.h with the following pragma
  1297.             at the end:
  1298.  
  1299.                  /*
  1300.                   * Routines that call setjmp have strange control flow
  1301.                  graphs,
  1302.                   * since a call to a routine that calls resume/longjmp
  1303.                  will eventually
  1304.                   * return at the setjmp site, not the original call site.
  1305.                  This
  1306.                   * utterly wrecks control flow analysis.
  1307.                   */
  1308.                  #pragma unknown_control_flow(sigsetjmp, setjmp, _setjmp)
  1309.  
  1310.             This eliminates  the  error  messages,  but  not  the  warning
  1311.             messages.   It would probably be no worse to simply remove the
  1312.             #pragmas altogether, since they don't seem to  be  having  the
  1313.             intended effect, and that would eliminate the warning messages
  1314.  
  1315.  
  1316.  
  1317.  
  1318.             Page 20                                         May 25, 1990
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  1325.  
  1326.  
  1327.             also.
  1328.  
  1329.             C++ Translator +p option broken
  1330.  
  1331.             The +p option produces spurious errors under R2.1.   Edit  the
  1332.             master  Makefile  to not use the +p option when compiling with
  1333.             R2.1:
  1334.  
  1335.                  # C++ flags
  1336.                  # NOTE: Disable +p option when compiling with AT&T R2.1
  1337.                  #CCFLAGS = +p
  1338.                  CCFLAGS =
  1339.  
  1340.             Optional support for nested types
  1341.  
  1342.             You can optionally define the preprocessor symbol NESTED_TYPES
  1343.             to cause the NIH Class Library to use nested types under R2.1.
  1344.             Edit the master Makefile as follows:
  1345.  
  1346.                  # Compile with nested types (works with AT&T R2.1 and GNU
  1347.                  C++)
  1348.                  #NESTED_TYPES =
  1349.                  NESTED_TYPES = -DNESTED_TYPES
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.             May 25, 1990                                         Page 21
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.             Release Notes  NIH Class Library Revision 3.0  Release Notes
  1391.  
  1392.  
  1393.                  DN
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.             Page 22                                         May 25, 1990
  1451.  
  1452.  
  1453.